{include file="../_meta" /}
<body style="padding:3px;">
<table id="easyui_dg" class="easyui-datagrid" closable="true"></table>
<!-- 查看二维码 -->
<div id="dlg-qrcode" class="easyui-dialog" title="查看二维码" data-options="iconCls:'icon-ok'" style="width:335px;height:380px;padding:0px;margin:0px;" closed="true">
	<img id="img-qrcode" style="width:320px;height:320px;" src="">
</div>


<div id="dlg" data-options="iconCls:'icon-add'"></div>
<div id="dlg-train" data-options="iconCls:'icon-add'"></div>	


<script type="text/javascript">
// 查看二维码
function viewQRCode(eno){
	$('#dlg-qrcode').dialog('open');
	$('#img-qrcode').attr('src','employeeViewQRCode?employee_no='+eno);
}
// 操作栏目信息
function formatOperationShow(val,row,ind){
	return '<span style="cursor:pointer;" onclick="viewQRCode(\''+row.employee_no+'\')"><img src="/static/images/qrcode.png" title="查看二维码"></span><span style="padding-left:10px;cursor:pointer;" onclick="addUserTrain(\''+row.id+'\')"><img src="/static/images/add.jpg" title="添加认证信息"></span><span style="padding-left:10px;cursor:pointer;" onclick="addUser(\''+row.id+'\')"><img src="/static/images/pencil.png" title="修改员工信息"></span>';
}

// 格式化列数据
function formatStatusShow(val,row,ind) {		
	if (val == 1){
		return '<span style="color:green;">正常</span>';
	} else if(val == 2) {
		return '<span style="color:navy;">锁定</span>';
	}	 else if(val == 3) {
		return '<span style="color:orange;">离职</span>';
	}	 else if(val == 4) {
		return '<span style="color:red;">删除</span>';
	}	
}

// 添加用户
function addUser(a = 0){
	$('#dlg').dialog({
		title: '新增',
		width: 460,
		height: 440,
		closed: false,
		cache: false,
		content: "<iframe scrolling='auto' frameborder='0' src='employeeAdd?id="+a+"' style='width:100%; height:100%; display:block;'></iframe>",
		modal: true
	});
};
// 添加用户认证
function addUserTrain(a = 0){
	$('#dlg-train').dialog({
		title: '新增',
		width: 460,
		height: 360,
		closed: false,
		cache: false,
		content: "<iframe scrolling='auto' frameborder='0' src='employeeAddTrain?id="+a+"' style='width:100%; height:100%; display:block;'></iframe>",
		modal: true
	});
};


// dataGrid 工具栏
var toolbar = [{
		text:'新增员工',
		iconCls:'icon-add',
		handler:function(){ addUser();}
	}];
	
// 数据栅格
$('#easyui_dg').datagrid({
	loadMsg:"数据加载中,请稍后",
	url:"employeeLoad",
	rownumbers:true,
	toolbar: toolbar,
	pagination:true,
	singleSelect:true,
	fit:true,
	fitColumns:true,
	striped:true,
	pageSize:15,
	pageList:[15,20,30,40,50,100],
    columns:[[
		{field:'employee_no',title:'工号',width:60,align:'center'},
		{field:'employee_name',title:'姓名',width:50,align:'center'},
		{field:'departs',title:'部门',width:50},
		{field:'departs_section',title:'科室',width:50},
		{field:'section_room',title:'车间/班组',width:50},
		{field:'join_date',title:'入职时间',width:50,align:'center'},
		{field:'status',title:'状态',width:50,align:'center',formatter:formatStatusShow},
		{field:'operation',title:'操作',width:100,align:'center',formatter:formatOperationShow},
		{field:'memo',title:'备注',width:50,align:'left'},
    ]]
});


</script>			
			
</body>
</html>